package com.zlp.mall.upms.api.feign;


import com.zlp.mall.core.constant.SecurityConstants;
import com.zlp.mall.core.constant.ServiceNameConstants;
import com.zlp.mall.core.utils.api.Result;
import com.zlp.mall.upms.api.dto.req.OperLogReq;
import com.zlp.mall.upms.api.feign.factory.FeignOperLogServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import javax.validation.Valid;

/**
 * @author Zou.LiPing@
 * @Date 2021年4月7日15:20:28
 */
@FeignClient(contextId = "feignOperatingLogService",
        value = ServiceNameConstants.UMPS_SERVICE,
        fallbackFactory = FeignOperLogServiceFallbackFactory.class
)
public interface FeignOperLogService {

    /**
     * 保存日志
     * @param operLogReq 日志实体
     * @param from 内部调用标志
     * @return succes、false
     */
    @PostMapping("/log")
    Result<Boolean> saveLog(@Valid @RequestBody OperLogReq operLogReq,
                            @RequestHeader(SecurityConstants.FROM) String from);



}
